package com.huluobo.h3kotlinproject.category

import android.view.LayoutInflater
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.huluobo.h3kotlinproject.R
import com.huluobo.h3kotlinproject.databinding.ItemCategoryChildBinding
import com.huluobo.h3kotlinproject.databinding.ItemCategoryParentBinding

/**
 *  Created by LC on 2023/10/28.
 */
class CategoryChildAdapter(list: MutableList<CategoryBean>) :
    BaseQuickAdapter<CategoryBean, CategoryChildAdapter.CategoryViewHolder>(R.layout.item_category_child, list) {

    class CategoryViewHolder(var itemDataBinding: ItemCategoryChildBinding) : BaseViewHolder(itemDataBinding.root)

    override fun createBaseViewHolder(parent: ViewGroup, layoutResId: Int): CategoryViewHolder {
        val itemBinding = ItemCategoryChildBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        return CategoryViewHolder(itemBinding)
    }

    override fun convert(holder: CategoryViewHolder, item: CategoryBean) {
        holder.itemDataBinding.category = item
    }
}